<?php
/**
 * 菜单服务
 * @Auther 聂哥<376927050@qq.com>
 * @Date: 2022-10-12 11:27:48
*/
namespace app\admin\model\system;

class SystemMenu extends BaseModel
{
    protected $autoWriteTimestamp = true;
    protected $insert = ['user_id','href']; 
    
    protected function setUserIdAttr($value)
    {
        return session('admin.id');
    }

    protected function setHrefAttr($value)
    {
        return strtolower($value);
    }

    /**
     * 子权限
     */
    public function child()
    {
        return $this->hasMany('SystemMenu','pid','id');
    }

}